package com.passioneffect.collection {

	/**
	 * @author Passion Effect
	 */
	public class LinkListIterator {
		protected var current : ListItem;

		public function LinkListIterator(list : *) {
			init(list);
		}

		protected function init(list : *) : void {
			if(list is SimpleList) {
				this.current = SimpleList(list).getStartItem();
			}else if(list is ListItem) {
				this.current = ListItem(list);
			}
		}

		public function next() : ListItem {
			var nextObj : ListItem = current;
			current = current.next;
			return nextObj;
		}

		public function hasNext() : Boolean {
			if(current) {
				return true;
			}
			return false;
		}
	}
}
